<template>
    <div class="tab-contro">
        <div class="tab-contro-item" 
        v-for="(item ,index) in title" 
        :key="index" 
        :class="{active:index===currentIndex}" 
        @click="clickitem(index)">
        <span>{{item}}</span>
        </div>
       
    </div>
</template>

<script>
export default {
    name:'TabContro',
    props:{
        title:{
            type:Array,
            default(){
                return []
            }
        }
    },
    data(){
        return{
            currentIndex:0
        }
    },
    methods:{
        clickitem(index){
            this.currentIndex=index
            this.$emit('tabCkick',index)
        },
        
    }
}
</script>

<style scoped>
.tab-contro{
    display: flex;
    text-align: center;
    height: 40px;
    line-height: 40px;
    background-color: #fff;
    z-index: 100;
}
.tab-contro-item{
    flex: 1;
}
.tab-contro-item span{
padding: 5px;
}
.active{
    color: var(--color-high-text);
   
}
.active span{
 border-bottom: 2px solid var(--color-tint);
 
}
</style>